<template>
  <div class="rec">
    <!-- 头部 -->
    <div class="header">
        <div class="logo">
            <img src="../assets/imgs/logo.jpg" alt="">
        </div>
        <div class="inp">
            <div class="fdj">
                <img src="../assets/imgs/放大镜.png" alt="">
            </div>
            <div class="wenzi">搜索你爱的</div>
        </div>
        <router-link tag="div" to="/myspace" class="booklist">
            <div class="imgs">
                <img src="../assets/imgs/书架.png" alt="">
            </div>
            <div class="wenzi">
                书架
            </div>
        </router-link>
    </div>
    <!-- 切换 -->
    <div class="tabs">
        <router-link tag="div" to="/home" class="faxian">发现</router-link>
        <div class="tuijian">推荐</div>
        <router-link tag="div" to="/world" class="shijie">世界</router-link>
    </div>
    <!-- 大他们 -->
    <router-link tag="div" :to="'/show?id='+item.id" class="bigitem" v-for="(item,index) in homeman" :key="index">
        <div class="header">
            <div class="wenzi">
                {{item.fmname}}
            </div>
            <div class="watch">
                关注
            </div>
        </div>
        <div class="bq">
            <div class="item">{{item.fmbiaoqian[0]}}</div>
            <div class="item">{{item.fmbiaoqian[1]}}</div>
        </div>
        <div class="bigimg">
            <img :src="item.showimg" alt="">
        </div>
        <div class="under">
            <div class="one">{{item.zhangjie[0].name}}</div>
            <div class="two">点赞{{item.zan}}</div>
        </div>
    </router-link>
    
  </div>
</template>

<script>
import { getHomeData } from "../api/booklists"
export default {
    data(){
        return{
            homeman:null,
            rec:null
        }
    },
    created(){
        getHomeData().then((data)=>{
            this.homeman = data.homeman
            this.rec = data.rec
            console.log(this.homeman)
        })
    }
}
</script>

<style lang="scss">
.rec .bigitem{
    width: 100%;
    border-bottom: 5px solid #dfdfdf;
    .header{
        width: 90%;
        margin: 0 auto;
        display: flex;
        font-size: 16px;
        .wenzi{
            flex: 1;
            height: 30px;
            line-height: 30px;
        }
        .watch{
            width: 56px;
            height: 20px;
            font-size: 12px;
            line-height: 20px;
            border-radius: 10px;
            text-align: center;
            border: 1px solid #000;
        }
    }
    .bq{
        width: 90%;
        flex-wrap: wrap;
        display: flex;
        margin: 0 auto 10px;

        .item{
            margin: 0 5px;
            padding: 2px 5px;
            background-color: pink;
            border-radius: 5px;
            font-size: 12px;
        }
    }
    .bigimg{
        width: 90%;
        margin: 0 auto;
        img{
            width: 100%;
        }
    }
    .under{
        width: 90%;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        height: 40px;
        line-height: 40px;
        .one{
            font-size: 14px;
            color: #999;
        }
        .two{   
            font-size: 12px;
            color: #000;
        }
    }
}
.rec .header{
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    .logo{
        width: 46px;
        height: 46px;
        margin-left: 4px;
        img{
            width: 100%;
        }
    }
    .inp{
        flex: 1;
        height: 30px;
        border-radius: 15px;
        background-color: #dfdfdf;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 10px;
        .fdj{
            width: 20px;
            height: 20px;
            img{
                width: 100%;
            }
        }
        .wenzi{
            height: 20px;
            line-height: 20px;
            font-size: 12px;
            color: #000;
        }

    }
    .booklist{
        width: 60px;
        height: 36px;
        display: flex;
        align-items: center;
        .imgs{
            width: 20px;
            height: 20px;
            img{
                width: 100%;
            }
        }
        .wenzi{
            width: 30px;
            height: 36px;
            text-align: center;
            line-height: 36px;
            font-size: 12px;
        }
    }
}
.rec .tabs{
    width: 50%;
    margin: 0 auto 20px;
    height: 40px;
    line-height: 40px;
    display: flex;
    
    .faxian{
        margin: 0 15px;
        
    }
    .tuijian{
        margin: 0 15px;
        border-bottom: yellow solid 4px;
    }
    .shijie{
        margin: 0 15px;
    }
}
</style>